using System;

namespace NFreeMarker.Template
{
    /**
     * A simple implementation of the <tt>TemplateDateModel</tt>
     * interface. Note that this class is immutable.
     * <p>This class is thread-safe.
     * 
     * @version $Id: SimpleDate.java,v 1.11 2004/03/13 13:05:09 ddekany Exp $
     * @author Attila Szegedi
     */

    public class SimpleDate : ITemplateDateModel
    {
        private readonly DateTimeOffset _date;
        private readonly int _type;

        /**
         * Creates a new date model wrapping the specified date object and
         * having the specified type.
         */

        public SimpleDate(DateTimeOffset date, int type)
        {
            _date = date;
            _type = type;
        }

        public DateTimeOffset GetAsDate()
        {
            return _date;
        }

        public int GetDateType()
        {
            return _type;
        }

        public override string ToString()
        {
            return _date.ToString();
        }
    }
}